package cn.he.springboot.controller;

import cn.he.springboot.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 何澳
 * @create 2021-03-15 10:53
 */

@Controller
public class HelloController {
    @RequestMapping("/hello")
  public String hell(Model model){
       User u1= new User();
       u1.setName("heao");
       u1.setEmail("123@com");
       model.addAttribute("u1",u1);
        User u2= new User();
        u2.setName("heao2");
        u2.setEmail("123@com2");
        List<User> list=new ArrayList<>();
        list.add(u1);
        list.add(u2);
        model.addAttribute("list",list);

      return "hello";
  }
}
